function [] =errors()
global delta_t Tsum
global N N2
global Out hout
tspan=0:delta_t:Tsum;
m0=length(tspan);

dx1=zeros(m0, N, N2-1);    %要改q1
dy1=zeros(m0, N, N2-1);

for i=1:m0-1
    tk(i) = i*delta_t;  %时间刻度
end



for number=1: N
    for m1=1 : m0   %时间
        for i=2 : N2  %第几个飞机
            dx1(m1, number, i-1)= Out(i, number, 1, m1)-hout(i-1, number, 1, m1)-Out(1, number, 1, m1);
            dy1(m1, number, i-1)= Out(i, number, 2, m1)-hout(i-1, number, 2, m1)-Out(1, number, 2, m1);
        end
    end
end

% disp(m0)
% disp( size(tk) )
% disp( size(dx1( 2:m0-1, number, i-1 )) )

for number=1:N
    figure;grid on
%    disp(number)
    for i=2:N2   %第几个飞机
        hold on
        plot(tk, dx1( 2:m0, number, i-1 ))
    end
    xlabel('time(s)')
    ylabel('formation error(m)')
    title(['The formation errors of group', num2str(number)])
    
end